class Verify {
	paramISnotNull(value, title = "XX不能为空") {
		if (!value) {
			uni.showToast({
				title: title,
				icon: "none",
				duration: 2000
			})
			return false
		} else {
			return true
		}
	}
	arrayISnotNull(value, title = "数组不能为空") {
		if (!value.length) {
			uni.showToast({
				title: title,
				icon: "none",
				duration: 2000
			})
			return false
		} else {
			return true
		}
	}
	objISnotNull(value, title = "对象不能为空") {
		if (JSON.stringify(value) === '{}') {
			uni.showToast({
				title: title,
				icon: "none",
				duration: 2000
			})
			return false
		} else {
			return true
		}
	}
	aOrbEqual(a, b, title = "两个值不相等") {
		if (a !== b) {
			uni.showToast({
				title: title,
				icon: "none",
				duration: 2000
			})
			return false
		} else {
			return true
		}
	}
	verifyPhone(value, title = "请输入正确手机号码") {
		const myreg = /^1[3-9]\d{9}$/;
		if (!myreg.test(value)) {
			uni.showToast({
				title: title,
				icon: "none",
				duration: 2000
			})
			return false
		} else {
			return true
		}
	}
}

export default new Verify()
